//
//  TravelSubjectTableViewCell.m
//  NineGroupProject
//
//  Created by dllo on 15/12/24.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "TravelSubjectTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation TravelSubjectTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10 * WID, 5 * HEI, WIDTH - 10 * 2 * WID, 220 * HEI)];
    self.backImageView.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.backImageView];
    self.backImageView.userInteractionEnabled = YES;

    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.backImageView.frame.origin.x + 5 * WID, self.backImageView.frame.size.height - 30 * HEI - 20 * HEI, WIDTH, 30 * HEI)];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.textColor = [UIColor whiteColor];
    self.nameLabel.font = [UIFont boldSystemFontOfSize:20];
    self.nameLabel.numberOfLines = 0;

    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.backImageView.frame.origin.x + 5 * WID, self.backImageView.frame.size.height - 20 * HEI, WIDTH, 20 * HEI)];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.font = [UIFont systemFontOfSize:13];

    
}
-(void)setTravelSubject:(TravelSubjectModel *)travelSubject{
    if (_travelSubject != travelSubject) {
        
        _travelSubject = travelSubject;
        
    }
    
    self.nameLabel.text = travelSubject.name;
    self.titleLabel.text = travelSubject.title;
    self.backImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.backImageView.clipsToBounds = YES;
    [self.backImageView sd_setImageWithURL:[NSURL URLWithString:travelSubject.image_url] placeholderImage:[UIImage imageNamed:@"loading.jpg"]];

}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
